#include<iostream>
#include<cstdio>
using namespace std;
const int N = 1e6 + 10;
int arr[N];
int n, t;
double a;
int main()
{
	cin >> n;
	while (n--) {
		cin >> a >> t;
		for (int i = 1; i <= t; i++) {
			int temp = i * a;
			arr[temp] = 1 - arr[temp];
		}
	}
	for (int i = 1; i <= N; i++) {
		if (arr[i]) {
			cout << i << endl;
			break;
		}
	}
	return 0;
}